package lib;

import model_Ke.MatrixWeight;

public class UtilCurrent extends Util {

	protected UtilCurrent() {

	}

	@Override
	public double[][] copyMatrix(double[][] matrix) {
		int size = matrix.length;
		double[][] result = new double[size][size];
		for (int i = 0; i < size; i++) {
			for (int j = 0; j < size; j++) {
				result[i][j] = matrix[i][j];
			}
		}
		return result;
	}

	@Override
	public int[][] copyMatrix(int[][] matrix) {
		int size = matrix.length;
		int[][] result = new int[size][size];
		for (int i = 0; i < size; i++) {
			for (int j = 0; j < size; j++) {
				result[i][j] = matrix[i][j];
			}
		}
		return result;

	}

	@Override
	public String printMatrix(double[][] matrix) {
		String temp = "\n ";
		for (int i = 0; i < matrix.length; i++) {
			temp = temp + "\t" + i + "";
		}
		for (int i = 0; i < matrix.length; i++) {
			temp = temp + "\n" + i;
			for (int j = 0; j < matrix.length; j++) {
				if (matrix[i][j] == Double.POSITIVE_INFINITY)
					temp = temp + " \t~ ";
				else
					temp = temp + "\t" + matrix[i][j];
			}
		}
		// System.out.println(temp + "\n");
		return temp + "\n";
	}

}
